package org.jeecgframework.web.service;

import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.system.pojo.base.CbsEquipmentApplyDetailEntity;
import org.jeecgframework.web.system.pojo.base.CbsEquipmentApplyEntity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.List;

public interface CbsEquipmentApplyServiceI extends CommonService {

    public <T> void delete(T entity);

    public <T> Serializable save(T entity);

    public <T> void saveOrUpdate(T entity);

    /**
     * 默认按钮-sql增强-新增操作
     *
     * @param id
     * @return
     */
    public boolean doAddSql(CbsEquipmentApplyEntity t);

    /**
     * 默认按钮-sql增强-更新操作
     *
     * @param id
     * @return
     */
    public boolean doUpdateSql(CbsEquipmentApplyEntity t);

    /**
     * 默认按钮-sql增强-删除操作
     *
     * @param id
     * @return
     */
    public boolean doDelSql(CbsEquipmentApplyEntity t);

    /**
     * 根据备件申请单id获取备件详情信息
     *
     * @param id
     * @return
     */
    public List<CbsEquipmentApplyDetailEntity> getAllCbsEqipmentByEquipmentId(String id);

    /**
     * 根据备件申请单id获取备件详情信息
     *
     * @param id
     * @return
     */
    public CbsEquipmentApplyDetailEntity getAllCbsEqipmentByDetailId(String id);

    /*备件申请审批通过,向CSA发送短信和邮件通知*/
    public void sendEmailToCSA(String id) throws Exception;

    /**
     * 备件异常导出
     *
     * @param request
     * @param response
     */
    public void exportXLS(HttpServletRequest request, HttpServletResponse response);

    /*
    * 备件审批导出
    * */
    public void exportEquipmentXls (HttpServletRequest request, HttpServletResponse response);

    /*每10分钟执行一次，检查备件申请状态，超过两小时未审批的置成已通过*/
    public void getGetEquipmentApply();

    /**
     * 备件审批通过
     * @param so
     * @param id
     * @param csaAttention
     * @param engineerAttention
     * @return
     */
    public AjaxJson pass(String so,String id,String csaAttention,String engineerAttention);

    /**
     * 审批不通过
     * @param id
     * @param reasion
     * @return
     */
    public AjaxJson notPass(String id,String reasion);
}
